/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.yuhanginfo.modules.sys.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yuhanginfo.common.persistence.Page;
import com.yuhanginfo.common.service.CrudService;
import com.yuhanginfo.modules.sys.entity.Materiel;
import com.yuhanginfo.modules.sys.dao.MaterielDao;

/**
 * 平台商品信息管理Service
 * @author yinhao
 * @version 2017-09-11
 */
@Service
@Transactional(readOnly = true)
public class MaterielService extends CrudService<MaterielDao, Materiel> {

	@Autowired
	private MaterielDao materielDao;
	public Materiel get(String id) {
		Materiel m = new Materiel();
		m.setId(id);
		return super.get(m);
	}
	

	
	@Transactional(readOnly = false)
	public void save(String userId,Materiel materiel,String image,String detail,String service)throws Exception {
		
		super.save(materiel);
	}
	
	@Transactional(readOnly = false)
	public void delete(Materiel materiel) {
		super.delete(materiel);
	}
	
	public int isExistMaterielByVenderId(String venderId) {
		return materielDao.isExistMaterielByVenderId(venderId);
	}

	public Page<Materiel> materList(Page<Materiel> page, Materiel materiel) {
		materiel.setPage(page);
		page.setList(materielDao.materList(materiel));
		return page;
	}

	public List<Materiel> allList() {
		
		return materielDao.allList();
	}

	public Page<Materiel> auditingMaterList(Page<Materiel> page,Materiel materiel) {
		materiel.setPage(page);
		page.setList(materielDao.auditingMaterList(materiel));
		return page;
	}
    
	@Transactional(readOnly = false)
	public void updateAuditingStatus(Materiel materiel) {
		materielDao.updateAuditingStatus( materiel);
		
	}

	public Materiel selectById(String useId) {
		
		return materielDao.selectById(useId);
	}


}